import sqlite3
conn = sqlite3.connect('example.db')

c = conn.cursor()

c.execute("SELECT * FROM sqlite_master where name='test'")
tables = c.fetchall()
print c.description
print tables
if len(tables) == 0:
    c.execute('create table test (date text, trans text, symbol text, qty real, price real)')

c.execute("INSERT INTO test VALUES ('2006-01-05','BUY','RHAT',100,35.14)")

conn.commit()

c.execute("select count(*) from test")
print c.fetchone()

conn.close()
